home *** CD-ROM | disk | FTP | other *** search
- /* Show errors produced by Assemble.ced.
- **
- ** This ARexx script shows the next of the errors in the
- ** error list of BAsm, after a Assemble.ced run.
- ** CygnusEd is used to display the errors.
- **
- ** Written and copyright 1995-1996 by Ulrich Flegel.
- ** All rights are reserved to the author Ulrich Flegel.
- **
- ** Publication and distribution only allowed by explicitly written permission from the author.
- ** This software may be distribute on the Aminet CD-ROMs.
- **
- ** system requirements:
- ** Assemble.ced (V1.1 or higher)
- ** CygnusEd (V3.5 or higher)
- ** BAsm (V1.123 or higher)
- ** SetEnv (AmigaOS release)
- ** rx (ARexx release)
- **
- ** current version of this script:
- **
- ** $VER: NextError.ced V1.1 (06-Jan-96)
- **
- ** usage:
- ** call as ARexx Macro from CygnusEd as: "NextError.ced [LOCALE «Language»] [OPT «BAsmOptions»]"
- ** Example «Language»: deutsch
- ** Example «BAsmOptions»: -O+ -OW+
- **
- */
-
- /*============================================================================*/
-
- OPTIONS RESULTS /* enable return codes */
-
- /*============================================================================*/
-
- /* parameters used to control this program */
-
- /* NextError.ced [PORT «Port_CygnusEd»] [LOCALE «Language»] [OPT «BAsmOptions»] */
-
- PARSE ARG CommandLine
-
- /*============================================================================*/
-
- /* adapt the following variables to your system environment: */
-
- Assemble = 'BAsmify:Assemble.ced' /* here substitute the complete path/name of the Assemble.ced script */
- MaxViews = 20 /* here substitue the maximum number of views CygnusEd is able to open */
-
- /*============================================================================*/
-
- BAsmError_Max = 200
- BAsmError_OK = 0
- BAsmError_False = 20
- BAsmError_OpenError = 1
- BAsmError_SourceError = 2
- BAsmError_ReadError = 3
- BAsmError_UnknownOption = 4
- BAsmError_MemoryError = 5
- BAsmError_NoSourceFile = 6
- BAsmError_NoNextError = 7
- BAsmError_NoErrorList = 8
- BAsmError_NoNextWarning = 9
- BAsmError_NoWarningList = 10
-
- /*============================================================================*/
-
- /*
- ** Intialize parameter variables and parse commandline
- */
-
- Port_CygnusEd=''
- Language=''
- BAsmOptions=''
-
- DO FOREVER
- PARSE VAR CommandLine Parameter CommandLine
- IF Parameter = '' THEN LEAVE
- PARSE VAR CommandLine Argument CommandLine
- IF Argument = '' THEN LEAVE
-
- SELECT
- WHEN Parameter = 'PORT' THEN Port_CygnusEd=Argument
- WHEN Parameter = 'LOCALE' THEN Language=Argument
- WHEN Parameter = 'OPT' THEN BAsmOptions=Argument||CommandLine
- END
- END
-
- /*============================================================================*/
-
- /* Only Assemble.ced may supply the parameter Port_CygnusEd above !! */
- /* If parameter correct, it is assumed, that the first error is not to be skipped */
-
- IF (LEFT(Port_CygnusEd, 8) = 'rexx_ced') THEN
- InvokedByAssembleScript = TRUE
- ELSE
- InvokedByAssembleScript = FALSE
-
- /*============================================================================*/
-
- /* ARexx ports used */
-
- Port_BAsm='rexx_BASM'
-
- IF (Port_CygnusEd='') THEN Port_CygnusEd=ADDRESS()
- IF (LEFT(Port_CygnusEd, 8) ~= 'rexx_ced') THEN Port_CygnusEd='rexx_ced'
-
- /*============================================================================*/
-
- ScriptErrorLevel = 6
-
- SIGNAL ON SYNTAX /* ensure clean exit */
-
- IF ~ SHOW('P', Port_CygnusEd) THEN /* is CygnusEd AREXX port available ? */
- DO
- Say 'This script may only called by CygnusEd!'
- END
- ELSE
- DO
-
- OPTIONS FAILAT ScriptErrorLevel /* ignore warnings */
-
- /*============================================================================*/
-
- /*
- ** Non localized strings used
- */
-
-
- STRING_ThisScript='NextError.ced'
-
- /*
- ** Localization of strings used
- */
-
- IF ( Language = '' ) THEN /* ask CED for current language if none submitted */
- DO
- ADDRESS VALUE Port_CygnusEd
- /*'QUERY CAT'*/ /* !!! here find out which language CED uses currently */
- /*Language=RESULT*/
- END
-
- SELECT
- WHEN Language='deutsch' THEN
- DO
- STRING_Positive='OK'
- STRING_Negative='Abbrechen'
- STRING_Dismiss='Aufgeben'
- STRING_BAsmFailure_Title='BAsm Fehler-Report'
- ERROR_NoBAsm='Der Source wurde noch nicht assembliert! Soll dies JETZT geschehen?'
- ERROR_BASM_UnknownErrorCode='Ein unbekannter Fehler ist aufgetreten!'
- ERROR_BASM_NoNextErrorWarning='Keine weiteren Fehler bzw. Warnungen vorhanden!'
- ERROR_BASM_NoErrorWarningList='Keine Fehlerliste bzw. Warnungsliste vorhanden!'
- ERROR_BASM_InLine='in Zeile'
- ERROR_BASM_Of='von'
- END
- /*
- WHEN Language='XXX' THEN
- DO
- STRING_Positive='XXX'
- STRING_Negative='XXX'
- STRING_Dismiss='XXX'
- STRING_BAsmFailure_Title='XXX'
- ERROR_NoBAsm='XXX!'
- ERROR_BASM_UnknownErrorCode='XXX!'
- ERROR_BASM_NoNextErrorWarning='XXX!'
- ERROR_BASM_NoErrorWarningList='XXX!'
- ERROR_BASM_InLine='XXX'
- ERROR_BASM_Of='XXX'
- END
- */
- OTHERWISE
- DO
- STRING_Positive='OK'
- STRING_Negative='Cancel'
- STRING_Dismiss='Dismiss'
- STRING_BAsmFailure_Title='BAsm error report'
- ERROR_NoBAsm='The source is not yet assembled! Assemble NOW?'
- ERROR_BASM_UnknownErrorCode='An unknown error occurred!'
- ERROR_BASM_NoNextErrorWarning='No more errors/warnings!'
- ERROR_BASM_NoErrorWarningList='No error/warnings list!'
- ERROR_BASM_InLine='in line'
- ERROR_BASM_Of='von'
- END
- END
-
- /*============================================================================*/
-
- /*
- ** Prepare arguments for invocation of Assemble.ced
- */
-
- IF ( Port_CygnusEd = '' ) THEN
- Cmd_PORT=''
- ELSE
- Cmd_PORT='PORT '||Port_CygnusEd
-
- IF ( Language = '' ) THEN
- Cmd_LOCALE=''
- ELSE
- Cmd_LOCALE='LOCALE '||Language
-
- IF ( BAsmOptions = '' ) THEN
- Cmd_OPT=''
- ELSE
- Cmd_OPT='OPT '||BAsmOptions
-
- /*============================================================================*/
-
- /*
- ** Finally do something
- */
-
- IF ~ SHOW('P', Port_BAsm) THEN /* is BAsm running ? */
- DO
- ADDRESS VALUE Port_CygnusEd
- 'OKAY2 '||ERROR_NoBAsm
- IF (RESULT = 1) THEN ADDRESS COMMAND 'SYS:RexxC/rx '||Assemble||' '||Cmd_PORT||' '||Cmd_LOCALE||' '||Cmd_OPT||' '
- END
- ELSE
- DO
- OPTIONS FAILAT BAsmError_NoWarningList+1
-
- ADDRESS VALUE Port_BAsm
-
- IF (InvokedByAssembleScript = TRUE) THEN /* do not step over first error/warning! */
- DO
-
- 'BINITERROR'
- IF (RC = BAsmError_NoErrorList) THEN
- CALL RexxSetEnv( 'BAsmError.ced', 'end' )
- ELSE
- CALL RexxSetEnv( 'BAsmError.ced', 'init' )
-
- 'BINITWARNING'
- IF (RC = BAsmError_NoWarningList) THEN
- CALL RexxSetEnv( 'BAsmWarning.ced', 'end' )
- ELSE
- CALL RexxSetEnv( 'BAsmWarning.ced', 'init' )
-
- END
-
- ErrorState = RexxGetEnv( 'BAsmError.ced' )
- WarningState = RexxGetEnv( 'BAsmWarning.ced' )
-
- SELECT
- WHEN (ErrorState = 'init') THEN CALL RexxSetEnv( 'BAsmError.ced', 'step' )
- WHEN (ErrorState = 'step') THEN
- DO
- 'BNEXTERROR'
- IF (RC = BAsmError_NoNextError) THEN
- DO
- CALL RexxSetEnv( 'BAsmError.ced', 'end' )
- IF (WarningState = 'init') THEN CALL RexxSetEnv( 'BAsmWarning.ced', 'step' )
- END
- END
- WHEN (ErrorState = 'end') THEN
- SELECT
- WHEN (WarningState = 'init') THEN CALL RexxSetEnv( 'BAsmWarning.ced', 'step' )
- WHEN (WarningState = 'step') THEN
- DO
- 'BNEXTWARNING'
- IF (RC = BAsmError_NoNextWarning) THEN
- DO
- CALL RexxSetEnv( 'BAsmWarning.ced', 'end' )
- 'BEND'
- ADDRESS VALUE Port_CygnusEd
- 'OKAY1 '||ERROR_BASM_NoNextErrorWarning
- END
- END
- WHEN (WarningState = 'end') THEN
- DO
- 'BEND'
- ADDRESS VALUE Port_CygnusEd
- 'OKAY1 '||ERROR_BASM_NoErrorWarningList
- END
- OTHERWISE Say "Internal error: Invalid warning state!"
- END
- OTHERWISE Say "Internal error: Invalid error state!"
- END
-
- ErrorState = RexxGetEnv( 'BAsmError.ced' )
- WarningState = RexxGetEnv( 'BAsmWarning.ced' )
-
- IF ((ErrorState = 'step')|(WarningState = 'step')) THEN
- DO
- ADDRESS VALUE Port_BAsm
-
- IF (ErrorState='step') THEN
- 'BGETERROR'
- ELSE
- 'BGETWARNING'
-
- IF ((RC = BAsmError_OK)&(RESULT ~= '')) THEN
- DO
- PARSE VAR RESULT FailureLine '|' FailureOffset '|' FailureFile '|' FailureType ' ' FailureNumber ': ' FailureString '.'
- ADDRESS VALUE Port_CygnusEd
- 'JUMP TO FILE '||FailureFile
- IF (RESULT = 0) THEN /* file with error not in any view */
- DO
- 'STATUS 66' /* total # of open views */
- IF (RESULT >= MaxViews) THEN
- DO
- 'OKAY1 '||FailureType||' #'||FailureNumber||' '||ERROR_BASM_InLine||' '||FailureLine||' '||ERROR_BASM_Of||' '||FailureFile||': '||FailureString||'.'
- END
- ELSE
- DO
- 'OPEN NEW' /* make new view */
- 'OPEN "'||FailureFile||'"' /* load file with error into new view */
- 'JUMP TO BYTE '||FailureOffset
- 'OKAY1 '||FailureType||' #'||FailureNumber||' '||ERROR_BASM_InLine||' '||FailureLine||': '||FailureString||'.'
- END
- END
- ELSE
- DO
- 'JUMP TO BYTE '||FailureOffset
- 'OKAY1 '||FailureType||' #'||FailureNumber||' '||ERROR_BASM_InLine||' '||FailureLine||': '||FailureString||'.'
- END
- END
- END
- END
-
- OPTIONS FAILAT ScriptErrorLevel
-
- /*=============================================================================*/
-
- END /* IF ~ SHOW('P', Port_CygnusEd) */
-
- EXIT
-
- SYNTAX:
-
- SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
- ADDRESS VALUE Port_CygnusEd
- 'OKAY1 Script error!'
- EXIT
-
-
- RexxSetEnv: PROCEDURE
- PARSE ARG Name,Content
-
- ADDRESS COMMAND 'SetEnv "ENV:'||Name||'" "'||Content||'"'
-
- RETURN
-
-
- RexxGetEnv: PROCEDURE
- PARSE ARG Name
-
- IF OPEN(EnvFile,'ENV:'||Name,'r') THEN
- DO
- Content = READLN(EnvFile)
- CALL CLOSE EnvFile
- END
- ELSE Content = ""
-
- RETURN Content
-
-
- /*=============================================================================*/
-
-
- /*
- ** version history:
- ** ---------------
- **
- ** V1.0 : -first public version
- **
- ** V1.1 : -second public version
- **
- ** -enhanced locale handling
- ** -fixed port handling
- ** -fixed options handling
- **
- ** known bugs in the latest version/revision:
- ** -----------------------------------------
- ** - No smart localization supported. I don't know the ARexx CygnusEd command to find out the currect used language.
- **
- */
-
-